#define _CRT_SECURE_NO_WARNINGS 1
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define endl '\n'

void modify(ll x, string &s) {
    int st = 0, ed = 31;
    while (st < ed && ((x >> st) & 1) == 0) st++;
    while (st < ed && ((x >> ed) & 1) == 0) ed--;
    for (int i = st; i <= ed; i++)
        s += ((x >> i) & 1) + '0';
}

void solve() {
    ll a, b; cin >> a >> b;
    string s1, s2;
    modify(a, s1);
    modify(b, s2);
    if (s1.find(s2) != -1) cout << "Yes" << endl;
    else cout << "No" << endl;
}

int main() {
    ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
    int t; cin >> t;
    while (t--) {
        solve();
    }
    return 0;
}